package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description DeviceMapper
 * @Author shejunlian
 * @Date 2024-07-24
 */
@Mapper
public interface DeviceMapper {

    /**
     * 注册设备
     * @param device
     */
    void insert(Device device);

    @Select("select count(*) from device where device_name =#{deviceName}")
    Long countByDeviceName(String deviceDescription);

    /**
     * 分页查询设备列表
     * @param devicePageQueryDto
     * @return
     */
    Page<DeviceVo> pageQueryDevice(DevicePageQueryDto devicePageQueryDto);

    /**
     * 查询设备详细数据
     * @param iotId
     * @return
     */
    @Select("select * from device where iot_id =#{iotId}")
    DeviceVo selectByIoId(String iotId);

    /**
     * 删除设备
     * @param
     * @return
     */
    @Delete("DELETE FROM device where iot_id =#{iotId}")
    void deleteDevice(String iotId);



    Device selectByKey(Long id);

    void updateByPrimaryKeySelective(Device device);


    List<Long> selectNursingIdsByIotIdWithElder(String iotId);

    List<Long> selectNursingIdsByIotIdWithBed(String iotId);
}
